This section describes the video digitizer component functions that allow applications to control video digitization. Video digitizer components allow applications to start and stop the digitizing process. Your application can request continuous digitization or single-frame digitization. When a digitizer component is operating continuously, it automatically places successive frames of digitized video into the specified destination. When a digitizer component works with a single frame at a time, the application and other software, such as an image compressor component, control the speed at which the digitized video is processed.
You can use the VDSetPlayThruOnOff function in your application to enable or disable digitization. When digitization is enabled, the video digitizer component places digitized video frame into the specified destination continuously. The application stops the digitizer by disabling digitization. This function can be used with both destination options.
Alternatively, your application can control digitization on a frame-by-frame basis. The VDGrabOneFrame and VDGrabOneFrameAsync functions digitize a single video frame; VDGrabOneFrame works synchronously, returning control to your application when it has obtained a complete frame, while VDGrabOneFrameAsync works asynchronously. The VDDone function helps you to determine when the VDGrabOneFrameAsync function is finished with a video frame. Your application can define the buffers for use with asynchronous digitization by calling the VDSetupBuffers function. Free the buffers by calling the VDReleaseAsyncBuffers function.
The VDSetFrameRate function allows applications to control the digitizer's frame rate. The VDGetDataRate function returns the digitizer's current data rate.
The VDSetPlayThruOnOff function allows applications to control continuous digitization.
pascal VideoDigitizerError VDSetPlayThruOnOff
(VideoDigitizerComponent ci,
short state);
When opened, video digitizer components are always set to off, so that no digitization is taking place. Your application can use the VDSetPlayThruOnOff function to turn continuous digitization on and off.
Applications can also use single-frame digitization by calling the VDGrabOneFrame or VDGrabOneFrameAsync function, described in the next section and on VDGrabOneFrameAsync , respectively.
The VDGrabOneFrame function instructs the video digitizer component to digitize a single frame of source video.
All video digitizer components must support this function.
pascal VideoDigitizerError VDGrabOneFrame
(VideoDigitizerComponent ci);
The application specifies the destination for the digitized frame by calling either the VDSetPlayThruDestination function (described on VDSetPlayThruDestination ) or the VDSetPlayThruGlobalRect function (described on VDSetPlayThruGlobalRect ).
If the specified digitizer component is already digitizing continuously when the application calls VDGrabOneFrame , the digitizer component returns the next digitized frame and then stops. If the digitizer component is stopped, the component digitizes a single frame and then stops. To resume continuous digitization, applications should call the VDSetPlayThruOnOff function, which is described in the previous section.
The VDGrabOneFrame function supports synchronous single-frame video digitization--that is, the digitizer component does not return control to your application until it has successfully processed the next video frame. Some video digitizer components may also support asynchronous single-frame digitization. Applications can use asynchronous digitization by calling the VDGrabOneFrameAsync function, described on VDGrabOneFrameAsync .
The VDSetupBuffers function allows applications to define output buffers for use with asynchronous grabs. Video digitizer components extract information about the spatial characteristics of the video destinations from these buffers.
pascal VideoDigitizerError VDSetupBuffers
(VideoDigitizerComponent ci,
VdigBufferRecListHandle bufferList);
If you are developing a video digitizer component, note that the matrix field in the buffer list structure contains a pointer to the matrix structure. It is your responsibility to copy that matrix structure.
Applications must define the output buffers before starting an asynchronous grab.
Applications instruct digitizer components to grab a single frame by calling the VDGrabOneFrameAsync function, which is described on VDGrabOneFrameAsync .
Applications free these buffers by calling the VDReleaseAsyncBuffers function, which is described next.
The VDReleaseAsyncBuffers function allows an application to release the buffers that it allocates with the VDSetupBuffers function.
pascal VideoDigitizerError VDReleaseAsyncBuffers
(VideoDigitizerComponent ci);
The VDGrabOneFrameAsync function instructs the video digitizer component to start to digitize asynchronously a single frame of source video. Because the component digitizes the video asynchronously, the application is free to do other things while the digitization is performed.
pascal VideoDigitizerError VDGrabOneFrameAsync
(VideoDigitizerComponent ci,
short buffer);
Applications determine when the digitizer component is finished with a frame by calling the VDDone function, which is described in the next section.
When calling the VDGrabOneFrameAsync function, the application specifies the next destination video buffer, allowing the digitizer component to quickly switch from the current buffer to the next buffer. In this manner, your application's ability to grab video at high frame rates is enhanced. See "Multiple Buffering" for a discussion of multiple-buffered video digitization.
Applications can determine whether a video digitizer component supports asynchronous frame grabbing by examining the output capability flags of the digitizer component. Specifically, if the digiOutDoesAsyncGrabs flag is set to 1, the digitizer component supports the VDGrabOneFrameAsync function and the VDDone function, which is described in the next section.
Applications can use the VDGetCurrentFlags function (described on VDGetCurrentFlags ) to retrieve the digitizer component's output capability flags. If a video digitizer component does not support asynchronous digitization, applications must use the VDGrabOneFrame function (described on VDGrabOneFrame ) to perform single-frame digitization.
If the specified digitizer component is already digitizing continuously when the application calls VDGrabOneFrameAsync , the digitizer component returns the next digitized frame and then stops. If the digitizer component is stopped, the component digitizes a single frame and then stops. To resume continuous digitization, applications should call the VDSetPlayThruOnOff function, which is described on VDSetPlayThruOnOff .
The VDGrabOneFrameAsync function also allows applications to use more than one destination buffer for the digitized video. The application defines these buffers by calling the VDSetupBuffers function (described on VDSetupBuffers ). The application specifies one of these destination buffers for the digitized frame when it calls the VDSetPlayThruDestination function (described on VDSetPlayThruDestination ) or the VDSetPlayThruGlobalRect function (described on VDSetPlayThruGlobalRect ).
You can use the VDDone function in your application to determine if the VDGrabOneFrameAsync function is finished with a specific output buffer ( VDGrabOneFrameAsync is described in the previous section). Applications that use the VDGrabOneFrameAsync function to digitize video frames should call VDDone before working with a digitized image.
pascal VideoDigitizerError VDDone
(VideoDigitizerComponent ci, short buffer);
If the VDDone function returns a 0 result, the video digitizer component has not finished the specified asynchronous frame grab. If the result is nonzero, the frame has been processed and the application can proceed to use the contents of the specified buffer.
Applications can determine whether a video digitizer component supports asynchronous frame grabbing by examining the output capability flags of the digitizer component. Specifically, if the digiOutDoesAsyncGrabs flag is set to 1, the digitizer component supports the VDGrabOneFrameAsync and VDDone functions. Applications can use the VDGetCurrentFlags function to retrieve the component's output capability flags. See VDGetCurrentFlags for a description of the VDGetCurrentFlags function.
The VDDone function returns a long integer indicating whether the specified asynchronous frame grab is complete. If the returned value is 0, the video digitizer component is still working on the frame. If the returned value is nonzero, the digitizer component is finished with the frame and the application can perform its processing.
The VDSetFrameRate function allows an application to indicate its desired frame rate to the video digitizer. Note that some digitizers may not be able to support high frame rates.
pascal VideoDigitizerError VDSetFrameRate
(VideoDigitizerComponent ci,
Fixed framesPerSecond);
The VDGetDataRate function allows an application to retrieve information that describes the performance capabilities of a video digitizer.
pascal VideoDigitizerError VDGetDataRate
(VideoDigitizerComponent ci,
long *milliSecPerFrame,
Fixed *framesPerSecond,
long *bytesPerSecond);